package errmsg

// 错误码
const (
	SUCCESS            = 200
	FAIL               = 400
	USERNAME_EXIST     = 1000
	USERNAME_INVALID   = 1001
	PASSWORD_WRONG     = 1002
	PASSWORD_INVALID   = 1003
	PNUMBER_EXIST      = 1004
	PNUMBER_INVALID    = 1005
	USERNAME_INEXIST   = 1006
	PNUNBER_WRONG      = 1007
	PASSWORD_SAME      = 1008
	NNUMBER_DIFF       = 1009
	ARTICLE_NO         = 2000
	ARTICLE_INEXIST    = 2001
	ARTICLE_NOSER      = 2002
	PROFILE_NOEXIST    = 3000
	NICKNAME_EMPTY     = 3001
	LIKE_FAIL          = 4000
	LIKE_ALREADY       = 4001
	DISLIKE_FAIL       = 4002
	DISLIKE_ALREADY    = 4003
	PREFERENCE_NOEXIST = 4004
	CANCEL_FAIL        = 4005
	COMMENT_NO         = 5000
	COMMENT_INEXIST    = 5001
)

// 错误码对应消息
var errMsg = map[int]string{
	200: "SUCCESS",
	400: "FAIL",
	// user操作错误，1000开头
	1000: "用户名已存在",
	1001: "用户名不符合规范",
	1002: "用户名或密码错误",
	1003: "密码不符合规范",
	1004: "手机号已被绑定",
	1005: "手机号不合法",
	1006: "用户名不存在",
	1007: "手机号不匹配用户名",
	1008: "新密码与旧密码一致",
	1009: "新密码的两次输入不一致",
	// 文章操作错误，2000开头
	2000: "用户没有发表文章记录",
	2001: "未查询到文章",
	2002: "该关键词下没有文章记录",
	// 个人资料操作错误，3000开头
	3000: "个人资料不存在",
	3001: "昵称为空",
	// 赞/踩操作错误，4000开头
	4000: "赞失败",
	4001: "已经赞过了",
	4002: "踩失败",
	4003: "已经踩过了",
	4004: "没有赞/踩过",
	4005: "取消失败",
	// 评论操作错误，5000开头
	5000: "没有评论",
	5001: "未查询到评论",
}

// GetErrMsg 返回错误码消息
func GetErrMsg(n int) string {
	return errMsg[n]
}
